package com.wanghlme.exercise05.service.impl;

import com.wanghlme.exercise05.dao.IEmpDao;
import com.wanghlme.exercise05.dao.impl.EmpDaoImpl;
import com.wanghlme.exercise05.pojo.Emp;
import com.wanghlme.exercise05.service.IEmpService;
import com.wanghlme.exercise05.util.MD5;

import java.util.List;

public class EmpServiceImpl implements IEmpService {
    private IEmpDao empDao;

    public EmpServiceImpl() {
        empDao = new EmpDaoImpl();
    }

    @Override
    public Emp queryEmpByLogin(String un, String up) {
        return empDao.queryEmpByLogin(un, MD5.enctypeMD5("QST" + up));
    }

    @Override
    public List<Emp> listAllEmployee() {
        return empDao.listAllEmployee();
    }

    @Override
    public int saveEmp(Emp emp) {
        return empDao.saveEmp(emp);
    }

    @Override
    public int delEmp(Integer id) {
        return empDao.delEmp(id);
    }

    @Override
    public Emp queryOneById(Integer id) {
        return empDao.queryOneById(id);
    }
}
